package com.guigu.service.impl.stock;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.mapper.stock.SWarehouseSettingMapper;
import com.guigu.pojo.design.DFile;
import com.guigu.pojo.stock.SWarehouseSetting;
import com.guigu.service.stock.SWarehouseSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr.Zhang
 * @since 2024-12-25
 */
@Service
public class SWarehouseSettingServiceImpl extends ServiceImpl<SWarehouseSettingMapper, SWarehouseSetting> implements SWarehouseSettingService {

    @Autowired
    private SWarehouseSettingMapper sWarehouseSettingMapper;

    @Override
    public PageInfo<SWarehouseSetting> selectSwarehouseSetting() {
        Integer pageNum = 1;
        Integer pageSize = 5;

        PageHelper.startPage(pageNum,pageSize);
        List<SWarehouseSetting> sWarehouseSettings =
                sWarehouseSettingMapper.selectList(null);

        PageInfo<SWarehouseSetting> pageInfo = new PageInfo<>(sWarehouseSettings);
        return pageInfo;
    }

    @Override
    public SWarehouseSetting getWarehouseName(String warehouseId) {
        QueryWrapper<SWarehouseSetting> query = new QueryWrapper<>();
        query.eq("WAREHOUSE_ID",warehouseId);

        SWarehouseSetting sWarehouseSetting = sWarehouseSettingMapper.selectOne(query);

        return sWarehouseSetting;
    }
}
